﻿<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" href="plugins/layui/css/layui.css" media="all" />
        <link rel="stylesheet" href="css/global.css" media="all">
        <link rel="stylesheet" href="plugins/font-awesome/css/font-awesome.min.css">
        <link href="css/table.css" rel="stylesheet" />
       <style>
        

       </style>

        <script src="js/jquery-3.1.1.min.js"></script>
	</head>

	<body>
		<div style="margin: 15px;" class=''>

                <div class="admin-main">
                    <blockquote class="layui-elem-quote">
                        <a href="javascript:;" class="layui-btn layui-btn-small" id="adduser">
                            <i class="layui-icon">&#xe608;</i> 添加用户
                        </a>
                        <a href="#" class="layui-btn layui-btn-small" id="dellAll">
                            <i class="layui-icon">&#xe608;</i> 批量删除
                        </a>
                        <a href="#" class="layui-btn layui-btn-small" id="reload">
                            <i class="fa fa-shopping-cart" aria-hidden="true"></i> 刷新页面
                        </a>
                        <a href="javascript:;" class="layui-btn layui-btn-small" id="search">
                            <i class="layui-icon">&#xe615;</i> 搜索
                        </a>
                    </blockquote>
                    <div id="main" class='layui-form' ></div>

                        <div class=""><!--admin-table-page-->
                            
                            <div class="" style="float: left;">
                                <div id="page" class="page"></div>
                            </div>
                            <div class="" style="float: right;width:240px;">
                                <!--<label style="float: left;padding:13px 0;width:180px;">Showing 10 to 40 of  rows</label>
                                <div style="float: right;padding:13px 0;width:180px;">
                                    <select id="select_row"  lay-filter="select_row" onchange="namespaces.Param.changerow(this.value);">
                                        <option value="10">每页10行</option>
                                        <option value="20">每页20行</option>
                                        <option value="30">每页30行</option>
                                        <option value="40">每页40行</option>
                                    </select>
                                </div>-->
                                <label style="float: left;padding:13px 0;">Showing 10 to 40 of  rows</label>
                                <div style="padding:10px 0;">
                                    <select id="select_row" lay-filter="select_row" >
                                        <option value="10">每页10行</option>
                                        <option value="20">每页20行</option>
                                        <option value="30">每页30行</option>
                                        <option value="40">每页40行</option>
                                    </select>
                                </div>
                            </div>
                        </div>

                    
                </div>

		</div>
		<script type="text/javascript" src="plugins/layui/layui.js"></script>
        <script src="ajax/main.js"></script>
		<script>
            $(document).ready(function () {
                if (localStorage.rowlength) { $("#select_row").val(localStorage.rowlength); } else { localStorage.rowlength = 10; }
                var Array_title = new Array("用户名", "密码", "邮箱", "注册时间","权限", "处理");
                var Array_id = new Array("id", "user_name", "user_pwd", "user_email", "time", "authority");
                
                layui.use(['form', 'laypage', 'layer'], function () {
                    var $ = layui.jquery,
                    layer = parent.layer === undefined ? layui.layer : parent.layer;
                    laypage = layui.laypage;
                    form = layui.form();
                    CJPlugin.init({
                        'get_url': "GetHandler",
                        'Array_id': Array_id,
                        'container': "main",
                        'row': 10,
                        'column': 7,
                        'Array_title': Array_title,
                        'table': "admin",
                        'curr_num': 0,
                        'select_row': localStorage.rowlength,
                        'select_item': Array_id,
                        'editMode': 'edit_c'
                    });
                    //form.render(); //更新全部
                    //form.render('checkbox'); 
                    form.on('checkbox(selected-all)', function (data) {
                        var elem = data.elem;

                        $('#cont').children('tr').each(function () {
                            var $that = $(this);
                            //全选或反选
                            $that.children('td').eq(0).children('input[type=checkbox]')[0].checked = elem.checked;
                            form.render('checkbox');//刷新select选择框渲染
                        });
                    });
                    //监听下拉框开关
                    //form.on('select(select_row)', function (data) {
                    //    namespaces.Param.changerow(data.value);
                    //});
        
                });
                //删除
                $('#dellAll').on('click', function () {
                    CJPlugin.deleteAll();
                });
                //刷新
                $('#reload').on('click', function () {
                    CJPlugin.reLoad();
                });
                //搜索按钮
                $('#search').on('click', function () {
                    parent.layer.alert('你点击了搜索按钮')
                });
                //添加用户按钮
                $('#adduser').on('click', function () {
                    //CJPlugin.openUsersWindow();
                    CJPlugin.openWindow(2, null, null, [0.2], null, ['460px', '320px'], null, 1, 'add-user', 0);
                });
                //每页条数
                $('#select_row').on('change', function () {
                   CJPlugin.changeRow(this.value);
                });
            });

		</script>
	</body>

</html>



